package com.onccc.social

import android.app.Application
import com.blankj.utilcode.util.Utils
import com.lzy.okgo.OkGo
import com.lzy.okgo.interceptor.HttpLoggingInterceptor
import okhttp3.OkHttpClient
import java.util.concurrent.TimeUnit
import java.util.logging.Level


class App : Application() {

    companion object{
        const val TARGET_PACKAGE_NAME = "com.tencent.mm"
    }
    override fun onCreate() {
        super.onCreate()
        Utils.init(this)
        initHttp()
    }

    private fun initHttp(){
        OkGo.getInstance().init(this)
        val builder = OkHttpClient.Builder()
        val loggingInterceptor = HttpLoggingInterceptor("OkGo")
        loggingInterceptor.setColorLevel(Level.INFO);

        builder.addInterceptor(loggingInterceptor)
        builder.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
        builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
        builder.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);

    }
}